package com.fjut.controller;

import com.fjut.result.Result;
import com.fjut.service.SubjectService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import javax.servlet.http.HttpServletResponse;

/**
 * <p>
 * 课程科目 前端控制器
 * </p>
 *
 * @author DengTianxun
 * @since 2023-03-06
 */
@Api(tags = "课程分类接口")
@RestController
@RequestMapping("/fjut/vod/subject")
//@CrossOrigin
public class SubjectController {

    @Autowired
    private SubjectService subjectService;

    @ApiOperation("课程分类列表")
    @GetMapping("getChildSubject/{id}")
    public Result getChildSubject(@PathVariable("id") Long id){
        return Result.success(subjectService.selectSubjectById(id));
    }

    @ApiOperation("课程分类导出")
    @GetMapping("exportDate")
    public Result exportDate(HttpServletResponse response){
        subjectService.exportDate(response);
        return Result.success(null);
    }

    @ApiOperation("课程分类导入")
    @PostMapping("importDate")
    public Result importDate(MultipartFile file){
        subjectService.importDate(file);
        return Result.success(null);
    }

}

